import { FSDKState } from "../../init";
import { FBindFunction } from "../../tools/FBindFunction";

/**
 * 父类中只有共享属性，方法和抽象方法。不允许子类覆盖。
 * 使用c语言的联合方式。所有广告的属性和方法都在这里。
 */
export abstract class FBaseAd<T = any> {

    protected _id: string;//广告id；

    protected _sdk: T;

    protected state: FSDKState;

    protected funcHelper: FBindFunction = new FBindFunction();
    setState(s: FSDKState) {
        this.state = s
    }

    getState(): FSDKState {
        return this.state;
    }

    set id(id: string) {
        this._id = id;
    }

    get id() {
        return this._id
    }


    set sdk(s: T) {
        this._sdk = s;
    }

    get sdk() {
        return this._sdk;
    }
    getFunc(func: Function) {
        return this.funcHelper.getFunc(func, this)
    }
}